package com.example.shw

import android.app.Service
import android.app.WallpaperManager
import android.content.Intent
import android.os.IBinder

class ChangeService : Service(){
    private var wallpapers = intArrayOf(R.drawable.wlop001, R.drawable.wlop002,
        R.drawable.wlop003, R.drawable.wlop004, R.drawable.wlop005)
    private lateinit var wManager : WallpaperManager
    private var current = 0
    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        if (current >= 4) current = 0
        wManager.setResource(wallpapers[current++])
        return START_STICKY
    }

    override fun onCreate() {
        super.onCreate()
        wManager = WallpaperManager.getInstance(this)
    }
    override fun onBind(intent: Intent?): IBinder? {
        return null
    }
}